//
// NeL - bindings
// Copyright (C) 2010 Naush
//
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU Affero General Public License as
//published by the Free Software Foundation, either version 3 of the
//License, or (at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU Affero General Public License for more details.
//
//You should have received a copy of the GNU Affero General Public License
//along with this program.  If not, see <http://www.gnu.org/licenses/>.
package org.ryzom.nel.misc;

public class ICommand {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public ICommand(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(ICommand obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nelmiscJNI.delete_ICommand(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public boolean execute(String rawCommandString, Vector_String args, CLog log, boolean quiet, boolean human) {
    return nelmiscJNI.ICommand_execute__SWIG_0(swigCPtr, this, rawCommandString, Vector_String.getCPtr(args), args, CLog.getCPtr(log), log, quiet, human);
  }

  public boolean execute(String rawCommandString, Vector_String args, CLog log, boolean quiet) {
    return nelmiscJNI.ICommand_execute__SWIG_1(swigCPtr, this, rawCommandString, Vector_String.getCPtr(args), args, CLog.getCPtr(log), log, quiet);
  }

  public void setCategoryName(String value) {
    nelmiscJNI.ICommand_CategoryName_set(swigCPtr, this, value);
  }

  public String getCategoryName() {
    return nelmiscJNI.ICommand_CategoryName_get(swigCPtr, this);
  }

  public void setHelpString(String value) {
    nelmiscJNI.ICommand_HelpString_set(swigCPtr, this, value);
  }

  public String getHelpString() {
    return nelmiscJNI.ICommand_HelpString_get(swigCPtr, this);
  }

  public void setCommandArgs(String value) {
    nelmiscJNI.ICommand_CommandArgs_set(swigCPtr, this, value);
  }

  public String getCommandArgs() {
    return nelmiscJNI.ICommand_CommandArgs_get(swigCPtr, this);
  }

  public void setType(ICommand.TType value) {
    nelmiscJNI.ICommand_Type_set(swigCPtr, this, value.swigValue());
  }

  public ICommand.TType getType() {
    return ICommand.TType.swigToEnum(nelmiscJNI.ICommand_Type_get(swigCPtr, this));
  }

  public static void setLocalCommands(SWIGTYPE_p_std__mapT_std__string_NLMISC__ICommand_p_t value) {
    nelmiscJNI.ICommand_LocalCommands_set(SWIGTYPE_p_std__mapT_std__string_NLMISC__ICommand_p_t.getCPtr(value));
  }

  public static SWIGTYPE_p_std__mapT_std__string_NLMISC__ICommand_p_t getLocalCommands() {
    long cPtr = nelmiscJNI.ICommand_LocalCommands_get();
    return (cPtr == 0) ? null : new SWIGTYPE_p_std__mapT_std__string_NLMISC__ICommand_p_t(cPtr, false);
  }

  public static void setLocalCommandsInit(boolean value) {
    nelmiscJNI.ICommand_LocalCommandsInit_set(value);
  }

  public static boolean getLocalCommandsInit() {
    return nelmiscJNI.ICommand_LocalCommandsInit_get();
  }

  public static boolean execute(String commandWithArgs, CLog log, boolean quiet, boolean human) {
    return nelmiscJNI.ICommand_execute__SWIG_2(commandWithArgs, CLog.getCPtr(log), log, quiet, human);
  }

  public static boolean execute(String commandWithArgs, CLog log, boolean quiet) {
    return nelmiscJNI.ICommand_execute__SWIG_3(commandWithArgs, CLog.getCPtr(log), log, quiet);
  }

  public static boolean execute(String commandWithArgs, CLog log) {
    return nelmiscJNI.ICommand_execute__SWIG_4(commandWithArgs, CLog.getCPtr(log), log);
  }

  public static void expand(SWIGTYPE_p_std__string commandName, CLog log) {
    nelmiscJNI.ICommand_expand__SWIG_0(SWIGTYPE_p_std__string.getCPtr(commandName), CLog.getCPtr(log), log);
  }

  public static void expand(SWIGTYPE_p_std__string commandName) {
    nelmiscJNI.ICommand_expand__SWIG_1(SWIGTYPE_p_std__string.getCPtr(commandName));
  }

  public static void serialCommands(IStream f) {
    nelmiscJNI.ICommand_serialCommands(IStream.getCPtr(f), f);
  }

  public static boolean exists(String commandName) {
    return nelmiscJNI.ICommand_exists(commandName);
  }

  public static boolean isCommand(String str) {
    return nelmiscJNI.ICommand_isCommand(str);
  }

  public static ICommand getCommand(String commandName) {
    long cPtr = nelmiscJNI.ICommand_getCommand(commandName);
    return (cPtr == 0) ? null : new ICommand(cPtr, false);
  }

  public String getName() {
    return nelmiscJNI.ICommand_getName(swigCPtr, this);
  }

  public static void enableControlCharForCommand(String commandName, boolean state) {
    nelmiscJNI.ICommand_enableControlCharForCommand(commandName, state);
  }

  public static boolean isControlCharForCommandEnabled(String commandName) {
    return nelmiscJNI.ICommand_isControlCharForCommandEnabled(commandName);
  }

  public final static class TType {
    public final static TType Unknown = new TType("Unknown");
    public final static TType Command = new TType("Command");
    public final static TType Variable = new TType("Variable");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static TType swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + TType.class + " with value " + swigValue);
    }

    private TType(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private TType(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private TType(String swigName, TType swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static TType[] swigValues = { Unknown, Command, Variable };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
